package zzg.study.reactor;

import com.sun.org.apache.xpath.internal.operations.String;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @Classname BuTask
 * @Description TODO
 * @Date 2025/1/27 17:03
 * @Author zhuzhenguo
 */
public class BuTask implements Runnable {

    private ByteBuffer buffer;

    private final SocketChannel socketChannel;


    public BuTask(ByteBuffer buffer, SocketChannel socketChannel) {
        this.buffer = buffer;
        this.socketChannel = socketChannel;
    }

    @Override
    public void run() {
        // 处理数据做业务
        buffer.flip();
        byte[] bytes = new byte[buffer.remaining()];
        buffer.get(bytes);
        buffer = null;
    }

}
